﻿#include "CPublicData.h"
#include <QFile>
#include <QDomDocument>
#include <QDebug>
#include <QCoreApplication>
#include <QLibrary>
#include <QDir>
#include <windows.h>
#include <qlibraryinfo.h>
bool CPublicData::initSql()
{
	if (m_pSqlDllOper == nullptr)
	{
		QString sConfigPath = QCoreApplication::applicationDirPath() + "/DLL/Belt.xml";
		// 获取当前程序路径
		QString exePath = QCoreApplication::applicationDirPath();
		// 构造 DLL 文件路径
		QString sDllPath = QDir(exePath).filePath("SqlOper.dll");
		m_pSqlDllOper = new CSqlDllOper(g_sTableName, sConfigPath, sDllPath);
	}
	return m_pSqlDllOper->initSql();
}


bool CPublicData::getConfig()
{
	return true;
}

bool CPublicData::saveConfig()
{
	return true;
}


CPublicData::CPublicData()
{
	m_bConfig = false;
	m_pSqlDllOper = nullptr;
	m_bSqlInit = false;
}

CPublicData::~CPublicData()
{
	if (m_pSqlDllOper != nullptr)
	{
		delete m_pSqlDllOper;
		m_pSqlDllOper = nullptr;
	}
}
